<?php

// if(empty($data)){
//     echo '<div style="text-align: center; margin-top: 200px;font-size: 20px;"> 请先创建分类</div>';
//     return;
// }
?>

<div class="form">

<?php $form=$this->beginWidget('CActiveForm', array(
	'id'=>'article-form',
	'enableAjaxValidation'=>false,
    'htmlOptions' => array('enctype'=>'multipart/form-data'),
)); ?>

    <p class="note"><span class="required">*</span> 是必填内容.</p>

	<div class="row">
		<?php echo $form->labelEx($model,'title'); ?>
		<?php echo $form->textField($model,'title',array('size'=>60,'maxlength'=>128)); ?>
		<?php echo $form->error($model,'title'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'content'); ?>
		<?php echo $form->textArea($model,'content',array('rows'=>6, 'cols'=>50)); ?>
		<?php echo $form->error($model,'content'); ?>
	</div>

    <div class="row">
        <?php echo $form->labelEx($model,'cover'); ?>
        <?php echo CHtml::activeFileField($model,'cover');?>
        <?php echo CHtml::label("图片大小:420*294",false); ?>
        <?php echo $form->error($model,'cover'); ?>
    </div>

    <div class='row'>
        <?php
        if(!empty($model->cover)){
            echo CHtml::label("封面预览",false);
            echo CHtml::image(Yii::app()->baseUrl.$model->cover,'',array("width"=>"450px"));
        }
        ?>
    </div>

	<div class="row">
        <?php echo $form->hiddenField($model,'columnid',array('id'=>'columnid')); ?> 
    </div>

	<div class="row buttons">
        <?php echo CHtml::submitButton($model->isNewRecord ? '新增' : '修改',array('class'=>'subButton')); ?>
	</div>

<?php $this->endWidget(); ?>

</div><!-- form -->